import { defineStore } from "pinia";

const useCounterStore = defineStore("counter", {
  state: () => {
    return {
      counter: 100,
    };
  },
  // 也可以定义为计算属性
  getters: {
    doubleCounter (state){
      return state.counter * 2
    }
  },
  actions: {
    changeCounterAction(newCounter){
      this.counter = newCounter
    }
  },
})

export default useCounterStore
